package demo2;

class OuterClass{
    public int data1=1;
    public int data2=2;
    public static int data3=3;
    //静态内部类，外部类的里面，方法的外面，并且用static修饰
    static class InnerClass{
        public int data1=100;
        public int data4=4;
        public int data5=5;
        public static int data6=6;

        //静态内部类的成员方法
        public void test(){
            System.out.println("InnerClass::test()");
            OuterClass outerClass=new OuterClass();
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
            System.out.println("###########");
            System.out.println(outerClass.data1);
            System.out.println(data3);
        }
    }
    public void testA(){
        System.out.println("OuterClass::testA()");
    }
}
public class Test2{
    public static void main(String[] args) {
        OuterClass.InnerClass innerClass=new OuterClass.InnerClass();//相当于外部类的一个成员变量
        innerClass.test();
    }
}